package com.javacv.plus.extensions.video.config;

import com.javacv.plus.core.config.ProcessorConfig;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 视频处理配置
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class VideoConfig extends ProcessorConfig {
    
    /**
     * 输出视频编码器
     */
    private String videoCodec = "libx264";
    
    /**
     * 输出音频编码器
     */
    private String audioCodec = "aac";
    
    /**
     * 视频质量 (0-51, 越小质量越好)
     */
    private int quality = 23;
    
    /**
     * 视频比特率
     */
    private String videoBitrate = "1000k";
    
    /**
     * 音频比特率
     */
    private String audioBitrate = "128k";
    
    /**
     * 输出格式
     */
    private String outputFormat = "mp4";
    
    /**
     * 是否保留音频
     */
    private boolean keepAudio = true;
    
    /**
     * 硬件加速
     */
    private boolean hardwareAcceleration = false;
    
    /**
     * 创建视频配置构建器
     */
    public static VideoConfigBuilder videoBuilder() {
        return new VideoConfigBuilder();
    }
    
    /**
     * 视频配置构建器
     */
    public static class VideoConfigBuilder {
        private VideoConfig config = new VideoConfig();
        
        public VideoConfigBuilder input(String inputPath) {
            config.setInputPath(inputPath);
            return this;
        }
        
        public VideoConfigBuilder output(String outputPath) {
            config.setOutputPath(outputPath);
            return this;
        }
        
        public VideoConfigBuilder quality(int quality) {
            config.setQuality(quality);
            return this;
        }
        
        public VideoConfigBuilder videoBitrate(String bitrate) {
            config.setVideoBitrate(bitrate);
            return this;
        }
        
        public VideoConfigBuilder audioBitrate(String bitrate) {
            config.setAudioBitrate(bitrate);
            return this;
        }
        
        public VideoConfigBuilder format(String format) {
            config.setOutputFormat(format);
            return this;
        }
        
        public VideoConfigBuilder noAudio() {
            config.setKeepAudio(false);
            return this;
        }
        
        public VideoConfigBuilder hardwareAccel() {
            config.setHardwareAcceleration(true);
            return this;
        }
        
        public VideoConfig build() {
            return config;
        }
    }
} 